import {
  SET_USER,
  SET_LOGIN,
  SET_AUTH,

  SET_GLOBAL
} from '../constants/counter'

export const setUser = (user) => {
  return {
    type: SET_USER,
    user
  }
}

export const setLogin = (isLogin) => {
  return {
    type: SET_LOGIN,
    isLogin
  }
}

export const setAuth = (isAuth) => {
  return {
    type: SET_AUTH,
    isAuth
  }
}

// 异步的action
export function asyncAdd () {
  return dispatch => {
    setTimeout(() => {
      dispatch(add())
    }, 2000)
  }
}


export const setGlobal = (obj) => {
  return {
    type: SET_GLOBAL,
    payload: obj
  }
}